import 'package:flutter/material.dart';
import 'package:yyads_text/yyads_text.dart';
import 'package:yyads_text_example/main.dart';
import 'package:yyads_text_example/page/home.dart';

class SplishFlutter extends StatefulWidget {
  const SplishFlutter({ Key? key }) : super(key: key);

  @override
  _SplishFlutterState createState() => _SplishFlutterState();
}

class _SplishFlutterState extends State<SplishFlutter> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(toolbarHeight: 0,),
      body: Container(
        width: double.infinity,
        height: double.infinity,
        child: Stack(children: [
          Center(
            child: Text("闪金喵开屏图片展示",style: TextStyle(
              color: Colors.red,
              fontSize: 26
            ),),
          ),
          YyadsText.showSplash(
      splashCallBack:SplashCallBack(
        error: (e){
            Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context)=> Home()), (route) => false);
         },
        timeOut: (){
            Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context)=> Home()), (route) => false);
        }, 
        adShow: (){},
        adClicked: (){}, 
        adCanceled: (){
          Navigator.pushReplacement(context, MaterialPageRoute(builder: (context)=> Home()));
        }
      )),
        ],)
      )
      
    );
  }
}